#!/usr/bin/python

from cStringIO import StringIO
from datetime import datetime

##############################################################################
"""
  This object provides an interface for a blog service 
      Blogger, WordPress, Yahoo 360
  If you want to use a new blog service, provide implementation with a
     duck type (not a subclass)
"""
class BlogInterface(object):

      def __init__(self, configuration):
          if configuration.has_key('blog_service'):
              self.service = configuration['blog_service']
          else:
              raise ValueError('no blog_service')
          if configuration.has_key('blog_user'):
              self.user = configuration['blog_user']
          else:
              raise ValueError('no blog_user')
          if configuration.has_key('blog_password'):
              self.password = configuration['blog_password']
          else:
              raise ValueError('no blog_password')
          if configuration.has_key('blog_source'):
              self.source = configuration['blog_source']
          else:
              raise ValueError('no blog_source')

      def start(self):
          pass

      def write(self, title, content, author_name):
          return True;

      def download(self, target):
          pass

      def is_ready(self):
          return True

      def stop(self):
          pass

